

function checkForm() {
    var flag1=CheckIsNull("account");
    var flag2 = CheckIsNull("password");
    var flag3 = CheckIsNull("repassword");
    var flag4=CheckRepassword(flag2,flag3);

    return flag1&&flag2&&flag3&&flag4;

}




//通用校验是否为空
function CheckIsNull(id) {
    var node = document.getElementById("input"+id);
    var nodeDiv=document.getElementById(id+"Div");
    var nodeLabel=document.getElementById(id+"Label2");


    var reg=/^\s*$/;//符合正则返回true

    if(reg.test(node.value)){
        nodeLabel.innerHTML="不能为空"
        nodeDiv.className+=" has-error"
        return false;
    }else {
        nodeLabel.innerHTML="";
        nodeDiv.className="form-group";
        return true;
    }
}

//检查确认密码是否与密码一致
function CheckRepassword(f1,f2) {

    if(f1&&f2){
        var p1 = document.getElementById("inputpassword").value;
        var p2=document.getElementById("inputrepassword").value;
        var nodeDiv=document.getElementById("repasswordDiv");
        var nodeLabel=document.getElementById("repasswordLabel2");

        if(p1==p2){
            nodeLabel.innerHTML="";
            nodeDiv.className="form-group";
            return true;
        }else{
            nodeLabel.innerHTML="与密码保持一致"
            nodeDiv.className+=" has-error"
            return false;
        }

    }else{
        //为空直接返回false
        return  false;
    }
}
